package Operation;

import bookk.Book;
import bookk.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    /**
     * @param booklist
     */
    @Override
    public void work(BookList booklist) {
        System.out.println("请输入你要查找的书");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        int size = booklist.getUsesize();
        for (int i = 0; i < size; i++) {
            Book book = booklist.getBooks(i);
            if(book.getName().equals(name)){
                System.out.println("找到了这本书");
                System.out.println(book);
                return ;
            }
            System.out.println("没有找到这本书");
        }
    }
}
